// pages/news/news.js
import {News} from './news-model.js';
var news = new News();
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this._loadData();
  },

  _loadData: function () {
    news.getNews((res) => {
      this.setData({
        newsData: res.data
      });
    })
  },
  
  onNews: function (e) {
    var id = news.getDataSet(e, 'id');
    wx.navigateTo({
      url: '../news-info/news-info?id=' + id,
    })
  },
})